<template>
  <div class="content">
    <van-nav-bar title="消息详情" left-arrow @click-left="onClickLeft" />
    <div class="inner-content">
      <div class="info-content">
        <div class="left-content">
          <van-icon name="chat-o" color="#000" size="24" />
        </div>
        <div class="right-content">
          <div>
            <div class="title">
              通知
            </div>
            <div class="info">
              {{
                "蓝牙模块已收到，很小巧，跟usb wifi差不多，很精美，淘宝上购物第一次满分体验。插上试了一下，不会出现卡顿。win10是面驱动的，插上就可以直接使用，蓝牙耳机耳麦也可以使用，还有什么东西都可以连接的，实在是太方便的了。非常的满意，还有价格是真的超级便宜。物美价廉。会一直关注的。"
              }}
            </div>
            <div class="bottom-info">
              <div>通知日期：2025-09-01</div>
              <div>通知人：小黑娃</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
// import { updateMsgStatus, getMsgDetail } from "@/api/message";
import moment from "moment";
export default {
  data() {
    return {
      data: {
        content: "",
      },
    };
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1); 
    },
    //获取消息详情
    getMsgDetail(id) {
      const userId = this.$store.getters.userInfo.id;
      uni.showLoading({
        title: "加载中...",
      });
      getMsgDetail(userId, id)
        .then((res) => {
          this.data = res.data;
          console.log(res.data);
          this.updateMsgStatus(id);
        })
        .finally(() => {
          uni.hideLoading();
        });
    },
    //将消息状态改为已读
    updateMsgStatus(id) {
      const userId = this.$store.getters.userInfo.id;
      const data = {
        user_id: userId,
        notice_id: id,
      };
      updateMsgStatus(data);
    },
  },
};
</script>

<style scoped lang="scss">
::v-deep .van-nav-bar .van-icon {
  color: #bbb;
}
.content {
  padding-bottom: 48px;

  .inner-content {
    padding: 12px;
    color: #101010;
    background-color: #fff;
    margin: 12px;
    border-radius: 8px;

    .info-content {
      display: flex;

      .right-content {
        margin-left: 10px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;

        .title {
          font-size: 16px;
          color: #101010;
        }

        .info {
          color: #888;
          font-size: 14px;
          margin-top: 12px;
        }

        .bottom-info {
          color: #888;
          font-size: 14px;
          margin-top: 32px;
        }
      }
    }
  }
}
</style>
